package com.mercury.pattern._05_adapter._002_objadpater;


/**
 * 转换器，将220v转换成5v
 * 当手机使用转换器时，能看到的都是5v的
 */
public class ChargerAdapter implements Voltage5V {
    Voltage220V voltage220V;

    public ChargerAdapter(Voltage220V voltage220V) {
        this.voltage220V = voltage220V;
    }

    @Override
    public int output5V() {
        int src = voltage220V.output220v();
        int desc = src/44;
        System.out.println("转换后：" + desc +" 伏");
        return desc;
    }
}
